import request from '@/utils/request'

// 查询绩效分配列表
export function listAllocation(query) {
  return request({
    url: '/project/allocation/list',
    method: 'post',
    data: query
  })
}

// 查询绩效分配列表
export function listAllocationConfirm(query) {
  return request({
    url: '/project/allocation/listAllocationConfirm',
    method: 'post',
    data: query
  })
}



//获取金额信息
export function getAllocationMoney(query) {
  return request({
    url: '/project/allocation/getAllocationMoney',
    method: 'post',
    data: query
  })
}

//获取当前项目的阶段确认人角色
export function getProjectRole(query) {
  return request({
    url: '/project/allocation/getProjectRole',
    method: 'post',
    data: query
  })
}

//确认分配
export function auditAllocation(query) {
  return request({
    url: '/project/allocation/auditAllocation',
    method: 'post',
    data: query
  })
}


//获取权限
export function getAuditPermission(query) {
  return request({
    url: '/project/allocation/getAuditPermission',
    method: 'post',
    data: query
  })
}



// 重新生成绩效信息
export function createAllocation(query) {
  return request({
    url: '/project/allocation/create',
    method: 'post',
    data: query
  })
}


export function isJoin(query) {
  return request({
    url: '/project/allocation/isJoin',
    method: 'post',
    data: query
  })
}





// 重新计算生成信息
export function reCreateAllocation(query) {
  return request({
    url: '/project/allocation/reCreate',
    method: 'post',
    data: query
  })
}


// 重新计算生成信息质保部分
export function reCreateWarranty(query) {
  return request({
    url: '/project/allocation/reCreateWarranty',
    method: 'post',
    data: query
  })
}


// 查询绩效分配详细
export function getAllocation(id) {
  return request({
    url: '/project/allocation/' + id,
    method: 'post',
  })
}

// 新增绩效分配
export function addAllocation(data) {
  return request({
    url: '/project/allocation',
    method: 'post',
    data: data
  })
}

// 修改绩效分配
export function updateAllocation(data) {
  return request({
    url: '/project/allocation',
    method: 'put',
    data: data
  })
}

// 删除绩效分配
export function delAllocation(id) {
  return request({
    url: '/project/allocation/' + id,
    method: 'delete'
  })
}



// 查询绩效分配列表
export function listDetail(query) {
  return request({
    url: '/project/allocationDetail/list',
    method: 'get',
    params: query
  })
}

// 查询绩效分配详细
export function getDetail(id) {
  return request({
    url: '/project/allocationDetail/' + id,
    method: 'get'
  })
}

// 
export function checkComplete(projectNo) {
  return request({
    url: '/project/allocationDetail/complete/' + projectNo,
    method: 'get'
  })
}

// 新增绩效分配
export function addDetail(data) {
  return request({
    url: '/project/allocationDetail',
    method: 'post',
    data: data
  })
}

// 修改绩效分配
export function updateDetail(data) {
  return request({
    url: '/project/allocationDetail',
    method: 'put',
    data: data
  })
}

export function setSaleMoney(data) {
  return request({
    url: '/project/allocationDetail/setSaleMoney',
    method: 'put',
    data: data
  })
}



// 绩效发放确认
export function confirmDetail(data) {
  return request({
    url: '/project/allocationDetail/confirm',
    method: 'put',
    data: data
  })
}


// 删除绩效分配
export function delDetail(id) {
  return request({
    url: '/project/allocationDetail/' + id,
    method: 'delete'
  })
}
